home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / FDF101.ARJ / SFDF.H < prev   
C/C++ Source or Header  |  1992-04-29  |  8KB  |  214 lines

  1. /*
  2.  * sfdf.h
  3.  *
  4.  * prototypes for sfdf.c - find duplicates.
  5.  *
  6.  * Roy Bixler (original development and Atari ST version)
  7.  * Ayman Barakat (idea)
  8.  * David Oertel (MS-DOS version)
  9.  *
  10.  * Version 1.0: March 14, 1991
  11.  * Version 1.01: April 12, 1992
  12.  *
  13.  * This program is free software; you can redistribute it and/or modify
  14.  * it under the terms of the GNU General Public License as published by
  15.  * the Free Software Foundation; either version 1, or (at your option)
  16.  * any later version.
  17.  *
  18.  * This program is distributed in the hope that it will be useful,
  19.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  * GNU General Public License for more details.
  22.  *
  23.  * You should have received a copy of the GNU General Public License
  24.  * along with this program; if not, write to the Free Software
  25.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26.  */
  27.  
  28.  
  29.  
  30. #define PROG_NAME    "sfdf"
  31. #define GETOPT_LIST    "IiLlM:m:O:o:S:s:Vv?"
  32. #define SFDF_USAGE \
  33. "%s - sorted find duplicate files\
  34. \nVersion 1.01, Copyright (c) 1992 Roy Bixler.\
  35. \n    \"sfdf\" comes with ABSOLUTELY NO WARRANTY; for details type `sfdf -?'.\
  36. \n    This is free software, and you are welcome to redistribute it\
  37. \n    under certain conditions.\
  38. \n\nusage: %s [-ma] [-m[cdns]] [-oa|d] [-sd|n|s] [-ilv?] path [...]\
  39. \n       where 'path' is the starting directory for finding\
  40. \n       duplicate files.\
  41. \nmatching criteria: (default = -mdns)\
  42. \n       -ma - consider name, size, date/time and contents\
  43. \n       -m[cdns] - set the combination of matching criteria\
  44. \n           c - file contents must match, implies 's' (sizes must match)\
  45. \n           d - date/time of files must match\
  46. \n           n - names must match\
  47. \n           s - size of files must match\
  48. \nsorting criteria: (default = -oa -sn)\
  49. \n       -oa|d - sort in ascending/descending order\
  50. \n       -sd|n|s - set the sorting criteria\
  51. \n           d - sort output by date/time\
  52. \n           n - sort output by name\
  53. \n           s - sort output by size\
  54. \noptions:\
  55. \n       -i - interactive delete\
  56. \n       -l - long listing of duplicate files\
  57. \n       -v - verbose, print statistics\
  58. \n       -vv - very verbose, also print activity report\
  59. \n       -? - print full documentation and exit\n"
  60.  
  61. #define SFDF_SCHPIEL1 \
  62. "sfdf - sorted find duplicate files\
  63. \nVersion 1.01, Copyright (c) 1992 Roy Bixler.\
  64. \n\
  65. \nGeneral Idea:\
  66. \n\
  67. \n    This program finds duplicate files on your disk(s).  It is\
  68. \n    possible to specify multiple disks and see duplicate files across\
  69. \n    disks.  You have control over criteria for finding duplicate files\
  70. \n    and the order in which the duplicates are presented.  For the\
  71. \n    really business-like, there is an interactive delete mode that\
  72. \n    presents you with menus asking which of the duplicate files to\
  73. \n    delete.  As an option, a statistical summary of the duplicate\
  74. \n    files is printed out at the end.\
  75. \n\
  76. \nUsage:\
  77. \n\
  78. \n    sfdf [-ma] [-m[cdns]] [-oa|d] [-sd|n|s] [-ilv?] path [...]\
  79. \n        where 'path' is the starting directory for finding duplicate\
  80. \n        files.\
  81. \n\
  82. \nMatching criteria:\
  83. \n\
  84. \n    Tells program what information to consider in determining whether\
  85. \n    a pair of files are duplicates or not.  The default is to consider\
  86. \n    files as duplicates if their names, modification date/times and\
  87. \n    sizes match (i.e. -mdns).\
  88. \n\
  89. \n        -ma - All.\
  90. \n            Consider name, size, date/time and contents.\
  91. \n\
  92. \n        -m[cdns] - Set the matching criteria.\
  93. \n            c - Contents.\
  94. \n                File contents must match, implies 's' (sizes must\
  95. \n                match).\
  96. \n\
  97. \n            d - Dates.\
  98. \n                Date/time of files must match.\
  99. \n\
  100. \n            n - Names.\
  101. \n                Names must match.\
  102. \n\
  103. \n            s - Sizes.\
  104. \n                Size of files must match.\
  105. \n\
  106. \nSorting criteria:\
  107. \n\
  108. \n    Tells program in what order to present the duplicate files.  The\
  109. \n    default is to sort by names and paths only.  If any options are\
  110. \n    specified below, the primary sort key is changed accordingly and\
  111. \n    the names and paths become the secondary sort key.  The\
  112. \n    performance will suffer noticeably if the primary sort key is not\
  113. \n    one of the match criteria.  Defaults are to sort by name in\
  114. \n    ascending order (i.e. -oa -sn).\
  115. \n\
  116. \n        -oa|d - Ordering.\
  117. \n            Sort in ascending/descending order.\
  118. \n\
  119. \n        -sd|n|s - set the sorting criteria.\
  120. \n            d - Dates.\
  121. \n                Sort output by date/time.\
  122. \n\
  123. \n            n - Names.\
  124. \n                Sort output by name.\
  125. \n\
  126. \n            s - Sizes.\
  127. \n                Sort output by size.\n"
  128.  
  129.  
  130. #define SFDF_SCHPIEL2 \
  131. "\nOptions:\
  132. \n\
  133. \n        -i - Interactive delete mode.\
  134. \n            Duplicate files are listed in menus.  Type in the numbers\
  135. \n            of the files you wish to delete or just hit <Return> to\
  136. \n            leave the files alone.  The numbers can be separated by\
  137. \n            commas or spaces.  Ranges of numbers can be specified by\
  138. \n            separating the lower and upper limits with a dash.\
  139. \n\
  140. \n        -l - Long listing of duplicate files.\
  141. \n            Gives date/time and size information on each duplicated\
  142. \n            file.\
  143. \n\
  144. \n        -v - Verbose, print statistics.\
  145. \n            Give information on number of files, number of duplicated\
  146. \n            files, number of duplicate names, total number of bytes\
  147. \n            and averages of each at the end.  When in 'interactive\
  148. \n            delete mode', also print out how many bytes in files you\
  149. \n            deleted.\
  150. \n\
  151. \n        -vv - Very verbose, also print activity report.\
  152. \n            In addition to printing statistics above, print out the\
  153. \n            directories searched for duplicate files.\
  154. \n\
  155. \n        -?\
  156. \n            Print full documentation and exit.  You are here!\
  157. \n\
  158. \nDifferences with 'fdf':\
  159. \n\
  160. \n    This program sorts the duplicate files list, which 'fdf' does not.\
  161. \n    It is also slower than 'fdf', but uses less memory.\
  162. \n\
  163. \nLicense:\
  164. \n\
  165. \n    This program is free software; you can redistribute it and/or modify\
  166. \n    it under the terms of the GNU General Public License as published by\
  167. \n    the Free Software Foundation; either version 1, or (at your option)\
  168. \n    any later version.\
  169. \n\
  170. \n    This program is distributed in the hope that it will be useful,\
  171. \n    but WITHOUT ANY WARRANTY; without even the implied warranty of\
  172. \n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\
  173. \n    GNU General Public License for more details.\
  174. \n\
  175. \n    You should have received a copy of the GNU General Public License\
  176. \n    along with this program; if not, write to the Free Software\
  177. \n    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\
  178. \n\
  179. \n    Please send bug reports and/or suggestions to:\
  180. \n        Roy Bixler\
  181. \n        420 S. 13th\
  182. \n        San Jose, CA 95112\
  183. \n    Include the name of the program, version and operating system.\
  184. \n\
  185. \n    Bug reports and other comments can also be sent as e-mail on the\
  186. \n        Internet to: rcb@netcom.com.\
  187. \n        UUCP: uunet!netcom.com!rcb\n"
  188.  
  189.  
  190.  
  191. typedef struct hash_list {
  192.     FILE_LIST *f_name;
  193.     struct hash_list *next;
  194. } HASH_LIST;
  195.  
  196.  
  197.  
  198. extern HASH_LIST *H_list[HASH_TAB_SIZE];
  199.  
  200.  
  201.  
  202. /* sfdf.c */
  203. void print_help(void);
  204. void show_doc(void);
  205. int sort_eq_match(void);
  206. void print_dups(FILE_LIST *start);
  207. int gen_id_menu(FILE_LIST *start, FILE_LIST **menu, int max_items);
  208. void id_dups(FILE_LIST *start);
  209. FILE_LIST *find_non_printed(FILE_LIST *file);
  210. void find_dups();
  211. void count_total_stats(void);
  212. int get_options(int argc, char **argv);
  213. int main(int argc, char **argv);
  214.